home *** CD-ROM | disk | FTP | other *** search
- Path: news.uregina.ca!usenet
- From: tristan@nether.net (Tristan Psionic)
- Newsgroups: comp.lang.c
- Subject: Re: Boot disk
- Date: 16 Mar 1996 21:04:55 GMT
- Organization: University of Regina
- Message-ID: <4ifadn$j3s@sue.cc.uregina.ca>
- References: <3144FCDF.38F3@plink.cityu.edu.hk> <Do3xqn.1HB@iquest.net>
- Reply-To: tristan@nether.net (Tristan Psionic)
- NNTP-Posting-Host: dec5057.cs.uregina.ca
- X-Newsreader: IBM NewsReader/2 v1.2.5
-
- In <Do3xqn.1HB@iquest.net>, dlmiller@iquest.net (Doug Miller) writes:
- >Jonathan Chiu Chi Hang <95471004@plink.cityu.edu.hk> wrote:
- >+Dear all,
- >+
- >+ Does anyone know how to write a program in C to make a disk that
- >+redirect the boot drive from drive A to drive B when boot time. What is
- >+the algoithm? Or provide the source code for reference.
- >+
- >+ Greatly appreciate any responses.
- >+
- >+Jonathan
- >What you are attempting to do is intrinsically impossible.
- >
- >Think about it: what will happen to your program when you reboot the computer?
- >
- >Further, I'm not aware of *any* PC BIOS that supports booting from the B drive. Switching your A and B drives
- >*cannot* be done solely through software, as you must either (1) swap cable connections on the drives, or (2) change
- >jumper settings on both drives; if the drives have different capacities (e.g. 1.2 MB and 1.44 MB), you must also alter
- >the BIOS settings for the drives (which can be done through software).
-
- Well, relax a little bit. You could do something to redirect it, but probably not
- in C. The answer is as simple as remembering what a master boot record on a
- hard drive does: loads in the real boot sector. So the MBR has pointers to hard
- drive partitions and one of them holds the sector that will load the OS. The
- MBR does nothing but handle loading another boot sector *from somewhere else*.
- The only way to do it, however, is to write a boot-sector to put on a disk in
- drive A: that reads in the boot sector from drive B: and jumps there. It may
- still be more complicated then that, as a boot sector probably uses some
- standardized drive code (0 for drive A: and 80h for drive C:) that is hard-coded
- into the boot sector code. So, you may have to peel through and switch stuff
- to point at B: (1 in BIOS terms). Think assembly though, C probably won't cut
- it. Write me, I can help you code it.
- -tristan (tristan@nether.net)
-